package graph;

/**
 * Node representing a 'while' statement. This class has a reference to the Node 
 * representing the condition, and another to the sequence of statements executed if the
 * condition is true (the loop).
 * 
 * @author Habib
 *
 */

public class WhileNode extends Node
{
	/**
	 * The Node representing the condition
	 */
	public BoolValueNode conditionNode;
	
	/**
	 * The Node representing the loop
	 */
	public BlockNode DoNode;
	
	/**
	 * Create a Node with null references.
	 */
	public WhileNode()
	{
		conditionNode = null;
		DoNode = null;
	}
	
	/**
	 * Sets the Node representing the condition.
	 * 
	 * @param node
	 */
	public void setConditionNode(BoolValueNode node)
	{
		conditionNode = node;
	}
	
	/**
	 * Sets the Node representing the loop
	 */
	public void setDoNode(BlockNode node)
	{
		DoNode = node;
	}
	
	/**
	 * Returns the condition node.
	 * 
	 * @return
	 */
	public BoolValueNode getConditionNode()
	{
		return conditionNode;
	}
	
	/**
	 * Returns the loop node.
	 * @return
	 */
	public BlockNode getDoNode()
	{
		return DoNode;
	}
	
	@Override
	public String toString()
	{
		return "while";
	}
}